/**
 * 定义一个存储session的地方
 */
(function($, owner) {

	/**
	 * 获取当前用户信息
	 **/
	owner.getUser = function() {
		var stateText = localStorage.getItem('$user') || "{account:sunafei}";
		return JSON.parse(stateText);
	};

	/**
	 * 设置当前状态
	 **/
	owner.setUser = function(state) {
		state = state || {};
		localStorage.setItem('$user', JSON.stringify(state));
	};

	/**
	 * 获取应用本地配置
	 **/
	owner.setSettings = function(settings) {
		settings = settings || {};
		localStorage.setItem('$settings', JSON.stringify(settings));
	}

	/**
	 * 设置应用本地配置
	 **/
	owner.getSettings = function() {
		var settingsText = localStorage.getItem('$settings') || "{}";
		return JSON.parse(settingsText);
	}
}(mui, window.app = {}));